package com.thinkingstar.iads.cs.sys.controller;

import com.thinkingstar.iads.common.filter.GlobalsFilter;
import com.thinkingstar.iads.common.filter.UserLoginFilter;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.*;

/**
 * 系统中心权限管理相关
 * @author Administrator
 *
 */
@IocBean
@At("/systemCenter")
@Filters({@By(type = GlobalsFilter.class), @By(type = UserLoginFilter.class)})
public class SystemCenterModule {
	
	private static final String SYS_CENTER_PATH = "beetl:/projectRoot/sysCenter/organization/";
	private static final String RESOURCE_MANAGER_PATH = "beetl:/projectRoot/sysCenter/resources/";
	private static final String ROLES_MANAGER_PATH = "beetl:/projectRoot/sysCenter/roles/";
	private static final String USERS_MANAGER_PATH = "beetl:/projectRoot/sysCenter/users/";

	private static final String  CENTER_NAME="系统中心";
	private static final String  ORG_MNG_NAME="机构管理";
	private static final String  ROLE_MNG_NAME="角色管理";
	private static final String  USER_MNG_NAME="用户管理";
	private static final String  RES_MNG_NAME="资源管理";
	
	/**
	 * 机构管理module
	 * @return
	 */
    @At("/organization")
    @Ok(SYS_CENTER_PATH+"organization.html")
	public NutMap organization(@Param("name") String name){
    	NutMap nutMap = new NutMap();
//    	nutMap.setv("00010001", name);
		nutMap.put("name", ORG_MNG_NAME);
		nutMap.put("centerName", CENTER_NAME);
    	return nutMap;
	}

	/**
	 * 角色管理module
	 * @return
	 */
	@At("/roles")
	@Ok(ROLES_MANAGER_PATH+"role.html")
	public NutMap role(@Param("name") String name){
		NutMap nutMap = new NutMap();
//		nutMap.setv("00010002", ROLE_MNG_NAME);
		nutMap.put("name", ROLE_MNG_NAME);
		nutMap.put("centerName", CENTER_NAME);

		return nutMap;
	}

	/**
	 * 用户管理module
	 * @return
	 */
	@At("/users")
	@Ok(USERS_MANAGER_PATH+"user.html")
	public NutMap user(@Param("name") String name){
		NutMap nutMap = new NutMap();
//		nutMap.setv("00010003", type);
		nutMap.put("name", USER_MNG_NAME);
		nutMap.put("centerName", CENTER_NAME);
		return nutMap;
	}

	/**
	 * 资源管理module
	 * @return
	 */
	@At("/resources")
	@Ok(RESOURCE_MANAGER_PATH+"resource.html")
	public NutMap resourcemanager(@Param("name") String name){
		NutMap nutMap = new NutMap();
//		nutMap.setv("00010004", type);
		nutMap.put("name", RES_MNG_NAME);
		nutMap.put("centerName", CENTER_NAME);
		return nutMap;
	}

}
